#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

class LCA{
public:
    int getLCA(int a, int b){
        while (a != b){
            if (a > b)
                a /= 2;
            else
                b /= 2;
        }
        return a;
    }
};

void Test1(){
    int n;
    cin >> n;
    int count = 0;
    int max_count = 0;
    while (n){
        if (n % 2 == 1)
            ++count;
        else{
            max_count = max(max_count, count);
            count = 0;
        }
        n /= 2;
    }
    max_count = max(max_count, count);
    cout << max_count << endl;
}

void Test2(){
    int n;
    cin >> n;
    int count = 0;
    while (n != 0){
        n &= n << 1;
        ++count;
    }
    cout << count << endl;
}

int main() {
    Test2();
    return 0;
}

